Skip to content

Conversation

@gribnoysup
Copy link
Collaborator

We disabled autoprs from dependabot recently because the tool doesn't really work in the monorepo (this is probably just more related to npm behaving weirdly often and not being able to do group version bumps well, but all dependabot PRs had various issues in them making them practically useless), but there's still a need for us to have some automation around version update especially because, as mentioned, doing it with npm is a pain sometimes.

This patch repurposes existing update-electron script to allow for it to work as a general purpose cli script to consistently update multiple packages to a certain version across our monorepo going through steps that we found work well and make sure that dependency tree is consistent.

For starters I'm replacing existing update electron and update eslint tasks to use the new script, in the future we can add other groups described in the _dependabot file to use it, I'm leaving this out for now, there's a ticket that we have to track this work.

@gribnoysup gribnoysup requested a review from a team as a code owner July 1, 2025 13:34
Comment on lines +7 to +11
// NB: We're always trying to update to latest major, this usually implies
// breaking changes, but those rarely affect us. If it becomes a problem, we
// can always change this code to lock it to whatever major version of
// electron compass is currently at
'electron',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a "breaking change" compared to what the old script was doing, manually trying this update locally it doesn't seem to break anything and as mentioned I do think we rarely affected by those, so it's probably okay to try to always update to latest, but tell me if you have thoughts on that.

@gribnoysup gribnoysup added the no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion) label Jul 1, 2025

const UPDATE_CONFIGS = require('./update-dependencies-config');

async function hoistSharedDependencies(newVersions) {
Copy link
Collaborator Author

@gribnoysup gribnoysup Jul 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be very clear, this flow is definitely sub optimal, we run install three (!) times, but it was also the only way we could consistently make npm do what we want instead of whatever it decides to do wrt shared dependencies and their current location in the dependency tree and debugging npm behavior on a pretty complex dependency tree is really really hard and I'm not sure it's worth it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we decide to update other deps using this scripts, they will also be hoisted at the top. And then running locally npm bootstrap, would it create updates in lock file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it with a few different dependencies and lock stays stable (meaning nothing is unexpectedly unhoisted) after running script a couple of times with different deps, but to be honest I don't know how to validate that this will never happen at all, I lost any trust in npm internal algorithms at this point 😆

@gribnoysup gribnoysup force-pushed the update-dependencies-script branch from 9f3aacd to a92db77 Compare July 1, 2025 13:54
console.log('Successfully updated dependencies');
}

main();
Copy link
Member

@Anemy Anemy Jul 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to update this to typescript? If it's possible that would be nice! Not a blocker.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, will need to add ts-register and allow cli.js to run typescript first, I'll take a stab as a follow-up

@gribnoysup gribnoysup merged commit fd3cd69 into main Jul 2, 2025
52 of 56 checks passed
@gribnoysup gribnoysup deleted the update-dependencies-script branch July 2, 2025 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants